solve by method of separation of variables